const util = require("../../../../utils/util")
const api = require('./api')
// pages/class_theory_test_rank/class_theory_test_rank.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    today: util.formatDate(new Date()),
    exam_date_list:[],
    cert_list:[],
  },

  // 选择考试日期
  sel_test_date(e){
    getApp().get_vibration()
    let index = e.currentTarget.dataset.index
    var exam_date = this.data.exam_date_list[index]
    this.setData({
      exam_date:exam_date,
    })
    api.load_exam_cert_list(this,this.jg_id, exam_date)
  },

  view_detail(e){
    getApp().get_vibration()

    let index = e.currentTarget.id
    let cert_id = this.data.cert_list[index].cert_id
    let cert_name = this.data.cert_list[index].cert_name
    wx.navigateTo({
      url: '/pages/students/exam/exam_details/exam_details?cert_name=' + cert_name + '&exam_date=' + this.data.exam_date + '&jg_id=' + this.jg_id + '&cert_id=' + cert_id,
    })
  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log('options',options)
    this.jg_id = options.jg_id
    api.load_exam_date_list(this, this.jg_id)
  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})